package com.flying.server.network.msg;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;

public class ORMsg {
	
	public static final int TIMEOUT_MILLS = 1000 * 15; //15�?
	/**
	 * 消息包头部长�?
	 * [MsgId(short)|MsgType(short)|Len(int)]
	 */
	public static final int MSG_HEADER_LEN = 8;
	/**
	 * 消息序列�?客户端消息标�?
	 */
	protected short msgSeq;
	/**
	 * 消息类型
	 */
	protected short msgType;
	/**
	 * 消息体buffer
	 */
	private ChannelBuffer bodyBuffer;
	/**
	 * 网络附件
	 */
	//private NetworkAttachment attachment;
	
	private Channel channel;
	
	public ORMsg (short msgType,short msgSeq)
	{
		this(msgType,msgSeq,null);
	}
	
	public ORMsg(short msgType,short msgSeq,ChannelBuffer buffer)
	{
		this.msgType = msgType;
		this.msgSeq = msgSeq;
		this.bodyBuffer = buffer;
	}
	/**
	 * 设置序列�?
	 * @param msgSeq
	 */
	public void setMsgSeq(short msgSeq)
	{
		this.msgSeq = msgSeq;
	}
	/**
	 * 获取序列�?
	 * @return
	 */
	public short getMsgSeq()
	{
		return msgSeq;
	}
	/**
	 * 获取消息类型
	 * @return
	 */
	public short getMsgType()
	{
		return msgType;
	}
	/**
	 * 获取消息体缓�?
	 * @return
	 */
	public ChannelBuffer getBodyBuffer()
	{
		return bodyBuffer;
	}
	
	/*
	public NetworkAttachment getAttachment()
	{
		return attachment;
	}
	*/
	
	public Channel getChannel()
	{
		return channel;
	}
	
	public void setChannel(Channel channel)
	{
		this.channel = channel;
	}
}
